package minov.parser;


/**
 * This class is for storing validation results.
 *
 */
public class ValidationResult {
   

   public ValidationResult(boolean validity, String errorMessage)
   {
      this._isValid = validity;
      this._errorMessage = errorMessage;
   }

   private boolean _isValid = false;
   
   /**
    * @return true if the validation was ok, false if there were some errors.
    *
    */
   public boolean isValid()
   {
      return _isValid;
   }

   private String _errorMessage = null;

   /**
    * @return the error message from the validation
    *
    */
   public String errorMessage()
   {
      return this._errorMessage;
   }
 
   //--------------------------------------
   // methods for creating valid and invalid 
   // validation results
   //--------------------------------------
   
   /**
    * Static method for creating new validation result with status "ok".
    * @return the validation result
    *
    */
   public static ValidationResult createValidResponse()
   {
      return new ValidationResult(true,null);
   }

   
   /**
    * Static method for creating new validation result with status "error".
    * @param [in] errorMessage error message to be put into the new validation result
    * @return the validation result
    *
    */
   public static ValidationResult createInvalidResponse(String errorMessage)
   {
      return new ValidationResult(false,errorMessage);
   }


}
